In this step of the tutorial you implement the functionality that handles the interactions in the description panel of the application:
To create the interaction for the widget description panel:
onProjectLoaded
function get the Back button node from the .kzb file using its alias and add the event handler for the Back button.virtual void onProjectLoaded() KZ_OVERRIDE { ... // Get the reference to the Back button in the description panel. NodeSharedPtr backButton = screen->lookupNode<Node>("#Back button"); // Add the handler for the Back button. backButton->addMessageHandler(Button3D::PressedMessage, bind(&ProgrammerTutorialApplication::onBackButtonClicked, this, placeholders::_1)); ... }
ProgrammerTutorialApplication
class after the onProjectLoaded
function implement the event handler for the Back button click message.class ProgrammerTutorialApplication : public ExampleApplication { ... // Handler for the Button.Pressed message for the Back button // in the Widget Description Layer node. void onBackButtonClicked(ButtonConcept::PressedMessageArguments& /*messageArguments*/) { // Instantiate the animation for the Camera node, in reverse order. m_camera->addAnimationItem(m_targetAnimationClip, true, 1); // Instantiate the animation for widget highlighting, in reverse order. m_selectedWidgetListBoxItem->addAnimationItem(m_highlightAnimationClip, true, 1); // Hide the Widget Description Layer node. m_widgetDescriptionNode->setVisible(false); } ... }